<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
<script type="text/javascript">
//地图api
function initialize() {
	var coordinate = location.href.match(/id=([0-9]+.[0-9]+,[0-9]+.[0-9]+)/);
	if(coordinate){
		coordinate = coordinate[1].toString();
		var arr = coordinate.split(","); //分割坐标

		var shop = location.href.match(/shop=([^&]*)/);
		shop = (!shop) ? "商家位置" : decodeURIComponent(shop[1].toString());
		
		var phone = location.href.match(/phone=([^&]*)/);
		phone = (!phone) ? "暂无" : decodeURIComponent(phone[1].toString());

		var map = new BMap.Map("container");
		var point = new BMap.Point(arr[0], arr[1]);
		map.centerAndZoom(point, 15);
		map.enableDragging();//启用地图拖拽事件，默认启用(可不写)
		map.disableScrollWheelZoom();//启用地图滚轮放大缩小(可不写)
		map.enableDoubleClickZoom();//启用鼠标双击放大，默认启用(可不写)
		map.disableKeyboard();//禁用键盘上下左右键移动地图，默认禁用(可不写)

		map.addControl(new BMap.NavigationControl());  //添加鱼骨

		var marker = new BMap.Marker(point);  // 创建标注
		map.addOverlay(marker);              // 将标注添加到地图中
		marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
		
		var infoWindow = new BMap.InfoWindow("联系电话：" + phone, {width:200,height:80,title:shop});  // 创建信息窗口对象
		map.openInfoWindow(infoWindow, map.getCenter());
		marker.addEventListener("click", function(){          
		   this.openInfoWindow(infoWindow);  
		});
	}
}
</script>
</head>
<body style="margin:0" onload="initialize()">
	<div id="container" style="width:700px;height:370px"></div>
</body>
</html>
